//
//  BDMD5.m
//  BadBoy
//
//  Created by wen on 2017/2/14.
//  Copyright © 2017年 niusaibing. All rights reserved.
//

#import "BDMD5.h"
#import <CommonCrypto/CommonDigest.h>


@implementation BDMD5
+ (NSString *)MD5Encrypt:(NSString *)str{
    const char *us_str = [str UTF8String];
    unsigned char result[CC_MD5_DIGEST_LENGTH];
    CC_MD5(us_str, strlen(us_str), result);
    NSMutableString *hash = [NSMutableString string];
    for (int i = 0; i < 16; i++){
        [hash appendFormat:@"%02X", result[i]];
    }
    return [hash lowercaseString];
}
@end
